function getList(){
	$.ajax({
		"url":"/activate/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"dataType":"jsonp",
		"success":function(data){
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			try{
				$("#machine_code").val(data.content.content.machine_code)
				$("#s").val(data.content.content.serial)
				$("#address").val(data.content.content.address)
				$("#showTime").css("display","block")
				$("#active_date").val(data.content.content.active_date)
				if(data.content.status===true){
					$("#activate-2").text("已激活").attr("disabled",true)
				}
			}
			catch(e){
				$("#machine_code").val(data.content.machine_code)
				
			}
		}
	})
}
function activate(){
	var data={}
	data.serial=$("#s").val().toUpperCase()
	data.address=$("#address").val().replace("-","")
	if(data.serial.length!==16){
		
		showErrorInfo("请填写正确的序列号！")
	}
	if (/^ *$/.test(address)){
		showErrorInfo("请填写您的注册地址！")
		return false;
	}
	data=JSON.stringify(data)
	$.ajax({
		"url":"/activate/",
		"data":{"data":data},
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"type":"POST",
		"success":function(data){
			data=JSON.parse(data)
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			showSuccessNotice("注册成功！")
			location.reload()
		}
	})
}
getList()
document.getElementById("activate-2").onclick=function(){
	activate()
}
